home *** CD-ROM | disk | FTP | other *** search
/ Point Programming 1 / PPROG1.ISO / pascal / swag / printing.swg / 0042_Controlling PRNTSCRN.pas < prev    next >
Encoding:
Pascal/Delphi Source File  |  1995-02-28  |  1.4 KB  |  55 lines

  1. {
  2. WK>Hello everyone! I am sorta new at Pascal, and have been dabbling around,
  3.   >trying to make a few useful programs.  Right now i am working a program that
  4.   >will generate a calender for a given year and print it out to the screen and
  5.   >printer. I have successfully been able to print it on the screen, but i have
  6.   >no idea how to get it out to the printer! Specifically, in my procedure that
  7.   >prints the calender to the screen, I use GOTOXY to position the dates. This
  8.   >doesn't work with the printer tho. Does anyone have any suggestions? Oh,
  9.   >also, i am using asterics to create boxes around the dates. thanx for any
  10.   >help!
  11.  
  12.   Well, you could press the PrntScr key after you have your calendar on
  13.   the screen. You can do the same in software:
  14. }
  15.     procedure PrintScreen;
  16.     begin
  17.       asm
  18.         int 5h
  19.       end;
  20.     end;
  21.  
  22.   If you don't want to print the whole screen, here's a little routine
  23.   that will print lines y1 through y2.
  24.  
  25. {-----------------------}
  26. procedure prnt_scr(y1,y2 : byte);
  27. var
  28.   c : char;
  29.   regs : registers;
  30.   x,y : byte;
  31.  
  32. begin
  33.   for y:= y1 to y2 do begin
  34.     for x:= 1 to 80 do with regs do begin
  35.       gotoxy(x,y);
  36.       ah:= 8;
  37.       bh:= 0;
  38.       intr($10,regs);
  39.  
  40.       (*
  41.       { uncomment to filter high ASCII chars }
  42.       if (al>=127) then
  43.         al:= 32;
  44.       *)
  45.  
  46.       ah:= 0;
  47.       dx:= 0;
  48.       intr($17,regs);
  49.     end;
  50.     writeln(lst);
  51.   end;
  52.   write(lst,ff);
  53. end;
  54.  
  55.